<html>
<head>
    <title>login</title>

    <script type="text/javascript" src="/js/jquery.min.js"></script>
</head>
<body>
<h1>login page</h1>

<div>
    <label for="username">
        用户名：
        <input value="admin" id="username"/>
    </label>
    <label>
        密码：
        <input type="password" value="admin" id="password"/>
    </label>
    <input type="button" id="login" value="登录"/>
</div>



<script type="text/javascript">
    $(function() {

        $("#login").click(function() {
            let username = $("#username").val()
            let password = $("#password").val()

            $.ajax({
              url: '/login/login-submit',
              type: 'POST',
              dataType: 'json',
              contentType: 'application/json',
              withCredentials: true,
              data: JSON.stringify({
                username: username,
                password: password
              }),
              success: function(res) {
                if (res.code !== 1) {
                  alert(res.message)
                  return
                }
                window.location.href = '/resume/list-page'
              }
            })
        })

    })
</script>
</body>
</html>
